package com.kklsqm.langchain4j.controller;

import com.kklsqm.langchain4j.service.ImageEraseCompletionService;
import com.kklsqm.langchain4j.service.ImageInstanceSegmentationService;
import jakarta.annotation.Resource;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.Map;

/**
 * 功能: 图像分割
 * 作者: 沙琪马
 * 日期: 2025/5/9 14:19
 */
@RestController
@RequestMapping("/image")
public class ImageInstanceSegmentationController {

    @Resource
    private ImageInstanceSegmentationService imageInstanceSegmentationService;

    @PostMapping("/segmentation")
    public ResponseEntity<Map<String, String>> eraseImage(@RequestParam String imageUrl) throws IOException {


        Map<String, String> resultUrl = imageInstanceSegmentationService.segmentImage(imageUrl);
        return ResponseEntity.ok(resultUrl);
    }

}
